package bank_system;
import java.util.Scanner;
public class person{
    private String id;  //账号ID
    private String password;  //账号密码
    private int balence;	//账户余额
    private String name;  //客户姓名
    public void Setname(String name) {
        this.name=name;
    }
    public String Getname() {
        return name;
    }
    public void Setid(String id) {
        this.id=id;
    }
    public String Getid() {
        return id;
    }
    public void Setpassword(String password) {
        this.password = password;
    }
    public String Getpassword() {
        return password;
    }
    public void Setbalence(int balence) {

        this.balence=this.balence+balence;
    }
    public int Getbalence() {
        return balence;
    }


    public static void main(String[] args) {
        // TODO Auto-generated method stub
        person p1 = new person();  //定义一个对象p1,并将其属性初始化。
        p1.Setid("2020014946");
        p1.Setbalence(1000);
        p1.Setpassword("12345");
        p1.Setname("张三");
        String number,password;
        System.out.println("请输入您的账号：");
        Scanner numb = new Scanner(System.in);
        number = numb.nextLine();   //读取账号
        boolean n;
        n=number.equals(p1.Getid());	//判断账号是否一致
        if(n==true){
            System.out.println("请输入您的账号密码：");
            Scanner pass = new Scanner(System.in);
            password = pass.nextLine();		//读取密码
            boolean m;
            m=password.equals(p1.Getpassword());	//判断密码是否正确
            if(m==true)			//密码正确，执行界面操作
            {
                System.out.println("请输入您要进行的操作：");
                System.out.println("1.存款");
                System.out.println("2.取款");
                System.out.println("3.修改密码");
                System.out.println("4.查询账户信息");
                System.out.println("5.退出");
                int i=0;
                Scanner scanner = new Scanner(System.in);
                i=scanner.nextInt();  //读取变量i
                switch(i){
                    case(1):{//存款
                        System.out.println("您要存款的金额为：");
                        int inbalence=0;
                        Scanner inba = new Scanner(System.in);
                        inbalence = inba.nextInt();
                        p1.Setbalence(inbalence);
                        System.out.println("存款后余额为：");
                        System.out.println(p1.Getbalence());
                    }
                    case(2): {//取款
                        System.out.println("您要取款的金额为：");
                        int withdrawal=0;
                        Scanner wi = new Scanner(System.in);
                        withdrawal = wi.nextInt();
                        p1.Setbalence(-withdrawal);
                        System.out.println("取款后余额为：");
                        System.out.println(p1.Getbalence());
                    }
                    case(3): {//修改密码
                        System.out.println("您要将密码修改为：");
                        String passed;
                        Scanner ps = new Scanner(System.in);
                        passed =ps.nextLine();
                        p1.Setpassword(passed);
                        System.out.println("修改后密码为：");
                        System.out.println(p1.Getpassword());
                    }
                    case(4):{//输出个人信息
                        System.out.print("您的个人信息为：");
                        System.out.println("");
                        System.out.print("Id：");
                        System.out.println(p1.Getid());
                        System.out.print("客户姓名：");
                        System.out.println(p1.Getname());
                        System.out.print("账户余额：");
                        System.out.println(p1.Getbalence());
                    }
                    case(5):{//退出
                        break;
                    }
                }
            }
            else{
                System.out.print("密码错误");//密码不一致，提示密码错误
            }
        }
        if(n==false){
            System.out.println("账号未注册");//账号不一致，提示未注册
        }

    }
}
